<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body id="body">
		<input type="button" onclick="getConnect()" id="bnt" value="连接" />
		<script type="text/javascript">
			function getConnect() {
				ws = new WebSocket('ws://123.56.232.166:5463/websocket');
				ws.onopen=function(){
					 alert("连接成功！");
					 document.getElementById("bnt").hidden="hidden";
				 }
				ws.onmessage=function(ev) {
					 document.getElementById("body").style.backgroundColor=ev.data;
				}
				ws.onclose=function(){
					document.getElementById("msg").innerHTML="未连接"
					ifOnClose();
				}
				ws.onerror=function(ev){
					msg.innerHTML+="<li>"+ev.data+ "错误" + "</li>";
				}
			}
		</script>
	</body>
</html>
